package W072_081.src.dao;


import W072_081.src.entity.Teacher;
import W072_081.src.util.Condition;
import W072_081.src.util.JdbcHelper;
import W072_081.src.util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

public class TeacherService implements W072_081.src.dao.TeacherServiceInterface {
    private static TeacherService instance = new TeacherService();
    private final static TeacherDao teacherDao = TeacherDao.getInstance();

    private TeacherService() {
    }

    public static TeacherService getInstance() {
        return instance;
    }

    public Collection<Teacher> findAll(List<Condition> conditionList, Pagination pagination) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        Collection<Teacher> teachers = teacherDao.findAll(connection, conditionList, pagination);
        JdbcHelper.close(connection);
        return teachers;
    }
}